<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!--类别数据-->
      <el-col :span="4" :xs="24" style="margin-top: 48px">
        <div class="head-container">
          <el-input
            v-model="typeName"
            placeholder="请输入类别名称"
            clearable
            size="small"
            prefix-icon="el-icon-search"
            style="margin-bottom: 20px"
          />
        </div>
        <div class="head-container">
          <el-tree
            :data="typeOptions"
            :props="defaultProps"
            :expand-on-click-node="false"
            :filter-node-method="filterNode"
            ref="tree"
            default-expand-all
            @node-click="handleNodeClick"
          />
        </div>
      </el-col>

      <el-col :span="20" :xs="24">
        <!--*****************************************项目工程级***********************************-->
        <el-divider content-position="left">项目工程级</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAddEng"
              v-hasPermi="['system:engin:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdateEng"
              v-hasPermi="['system:engin:edit']"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDeleteEng"
              v-hasPermi="['system:engin:remove']"
              >删除</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="info"
              plain
              icon="el-icon-upload2"
              size="mini"
              @click="handleImportEng"
              v-hasPermi="['system:engin:import']"
              >导入</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExportEng"
              v-hasPermi="['system:engin:export']"
              >导出</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-search"
              size="mini"
              @click="handleHeighEng"
              v-hasPermi="['system:engin:list']"
              >高级查询</el-button
            >
          </el-col>
          <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getListEng"></right-toolbar> -->
        </el-row>

        <el-table
          :data="enginList"
          @selection-change="handleSelectionChangeEng"
          highlight-current-row
          @current-change="handleCurrentChangeEng"
          border
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column
            label="分类号"
            align="center"
            prop="enginClassifiNum"
          />
          <el-table-column label="档号" align="center" prop="enginFileNum" />
          <el-table-column label="工程名称" align="center" prop="enginName" />
          <el-table-column
            label="单位工程名称"
            align="center"
            prop="unitProjectName"
          />
          <el-table-column
            label="工程地点"
            align="center"
            prop="projectLocation"
          />
          <el-table-column label="建设单位" align="center" prop="buildUnit" />
          <el-table-column
            label="施工单位"
            align="center"
            prop="constructiUnit"
          />
          <el-table-column
            label="立项批准单位"
            align="center"
            prop="projectApproveUnit"
          />
          <el-table-column label="设计单位" align="center" prop="designUnit" />
          <el-table-column label="勘察单位" align="center" prop="surveyUnit" />
          <el-table-column label="监理单位" align="center" prop="supervUnit" />
          <el-table-column
            label="质量安全监督单位"
            align="center"
            prop="qualitySupervUnit"
          />
          <el-table-column
            label="立项批准文"
            align="center"
            prop="projectApprovalNum"
          />
          <el-table-column
            label="工程规划许可证号"
            align="center"
            prop="enginplanPermitNum"
          />
          <el-table-column
            label="用地规划许可证号"
            align="center"
            prop="landplanPermitNum"
          />
          <el-table-column
            label="用地许可证号"
            align="center"
            prop="landusePermitNum"
          />
          <el-table-column
            label="施工许可证号"
            align="center"
            prop="constructiPermitNum"
          />
          <el-table-column
            label="规划许可证号"
            align="center"
            prop="planPermitNum"
          />
          <el-table-column
            label="总用地面积"
            align="center"
            prop="totalLandArea"
          />
          <el-table-column
            label="总建筑面积"
            align="center"
            prop="totalBuildArea"
          />
          <el-table-column label="建筑面积" align="center" prop="buildArea" />
          <el-table-column
            label="开工时间"
            align="center"
            prop="startTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.startTime, "{y}-{m}-{d}") }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="竣工时间"
            align="center"
            prop="completTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.completTime, "{y}-{m}-{d}") }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="工程预算"
            align="center"
            prop="projectBudget"
          />
          <el-table-column
            label="工程决算"
            align="center"
            prop="projectFinalAccounts"
          />
          <el-table-column label="案卷数" align="center" prop="filesCounts" />
          <el-table-column label="文字卷数" align="center" prop="textVolumes" />
          <el-table-column label="图纸卷数" align="center" prop="drawCounts" />
          <el-table-column label="保管期限" align="center" prop="storageTime" />
          <el-table-column label="密级" align="center" prop="secretLevel" />
          <el-table-column
            label="进馆日期"
            align="center"
            prop="entryDate"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.entryDate, "{y}-{m}-{d}") }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="移交单位"
            align="center"
            prop="handoverUnit"
          />
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
            width="120px"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdateEng(scope.row)"
                v-hasPermi="['system:engin:edit']"
                >修改</el-button
              >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDeleteEng(scope.row)"
                v-hasPermi="['system:engin:remove']"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="totalEng > 0"
          :total="totalEng"
          :page.sync="queryParamsEng.pageNum"
          :limit.sync="queryParamsEng.pageSize"
          @pagination="getListEng"
          :page-sizes="page_size"
        />

        <!-- 添加或修改项目工程管理对话框 -->
        <el-dialog
          :title="titleEng"
          :visible.sync="openEng"
          width="80%"
          append-to-body
        >
          <el-form
            ref="formEng"
            :model="formEng"
            :rules="rulesEng"
            label-width="80px"
          >
            <el-row>
              <el-col :span="6">
                <el-form-item label="类别" prop="typeId">
                  <treeselect
                    v-model="formEng.typeId"
                    :options="typeOptionsEng"
                    :show-count="true"
                    placeholder="请选择"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="分类号" prop="enginClassifiNum">
                  <el-input
                    v-model="formEng.enginClassifiNum"
                    placeholder="请输入工程分类号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="档号" prop="enginFileNum">
                  <el-input
                    v-model="formEng.enginFileNum"
                    placeholder="请输入工程档号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="工程名称" prop="enginName">
                  <el-input
                    v-model="formEng.enginName"
                    placeholder="请输入工程名称"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="单位工程名称" prop="unitProjectName">
                  <el-input
                    v-model="formEng.unitProjectName"
                    placeholder="请输入单位工程名称"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="工程地点" prop="projectLocation">
                  <el-input
                    v-model="formEng.projectLocation"
                    placeholder="请输入工程地点"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="建设单位" prop="buildUnit">
                  <el-input
                    v-model="formEng.buildUnit"
                    placeholder="请输入建设单位"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="施工单位" prop="constructiUnit">
                  <el-input
                    v-model="formEng.constructiUnit"
                    placeholder="请输入施工单位"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="立项批准单位" prop="projectApproveUnit">
                  <el-input
                    v-model="formEng.projectApproveUnit"
                    placeholder="请输入立项批准单位"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="设计单位" prop="designUnit">
                  <el-input
                    v-model="formEng.designUnit"
                    placeholder="请输入设计单位"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="勘察单位" prop="surveyUnit">
                  <el-input
                    v-model="formEng.surveyUnit"
                    placeholder="请输入勘察单位"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="监理单位" prop="supervUnit">
                  <el-input
                    v-model="formEng.supervUnit"
                    placeholder="请输入监理单位"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="质量安全监督单位" prop="qualitySupervUnit">
                  <el-input
                    v-model="formEng.qualitySupervUnit"
                    placeholder="请输入质量安全监督单位"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="立项批准文" prop="projectApprovalNum">
                  <el-input
                    v-model="formEng.projectApprovalNum"
                    placeholder="请输入立项批准文"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="工程规划许可证号"
                  prop="enginplanPermitNum"
                >
                  <el-input
                    v-model="formEng.enginplanPermitNum"
                    placeholder="请输入工程规划许可证号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="用地规划许可证号" prop="landplanPermitNum">
                  <el-input
                    v-model="formEng.landplanPermitNum"
                    placeholder="请输入用地规划许可证号"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="用地许可证号" prop="landusePermitNum">
                  <el-input
                    v-model="formEng.landusePermitNum"
                    placeholder="请输入用地许可证号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="施工许可证号" prop="constructiPermitNum">
                  <el-input
                    v-model="formEng.constructiPermitNum"
                    placeholder="请输入施工许可证号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="规划许可证号" prop="planPermitNum">
                  <el-input
                    v-model="formEng.planPermitNum"
                    placeholder="请输入规划许可证号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="总用地面积" prop="totalLandArea">
                  <el-input
                    v-model="formEng.totalLandArea"
                    placeholder="请输入总用地面积"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="总建筑面积" prop="totalBuildArea">
                  <el-input
                    v-model="formEng.totalBuildArea"
                    placeholder="请输入总建筑面积"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="建筑面积" prop="buildArea">
                  <el-input
                    v-model="formEng.buildArea"
                    placeholder="请输入建筑面积"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="开工时间" prop="startTime">
                  <el-date-picker
                    style="width: 170px"
                    clearable
                    size="small"
                    v-model="formEng.startTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择开工时间"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="竣工时间" prop="completTime">
                  <el-date-picker
                    style="width: 170px"
                    clearable
                    size="small"
                    v-model="formEng.completTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择竣工时间"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="工程预算" prop="projectBudget">
                  <el-input
                    v-model="formEng.projectBudget"
                    placeholder="请输入工程预算"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="工程决算" prop="projectFinalAccounts">
                  <el-input
                    v-model="formEng.projectFinalAccounts"
                    placeholder="请输入工程决算"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="案卷数" prop="filesCounts">
                  <el-input
                    v-model="formEng.filesCounts"
                    placeholder="请输入案卷数"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="文字卷数" prop="textVolumes">
                  <el-input
                    v-model="formEng.textVolumes"
                    placeholder="请输入文字卷数"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="图纸卷数" prop="drawCounts">
                  <el-input
                    v-model="formEng.drawCounts"
                    placeholder="请输入图纸卷数"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="保管期限" prop="storageTime">
                  <el-input
                    v-model="formEng.storageTime"
                    placeholder="请输入保管期限"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="密级" prop="secretLevel">
                  <el-input
                    v-model="formEng.secretLevel"
                    placeholder="请输入密级"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="进馆日期" prop="entryDate">
                  <el-date-picker
                    style="width: 170px"
                    clearable
                    size="small"
                    v-model="formEng.entryDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择进馆日期"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="移交单位" prop="handoverUnit">
                  <el-input
                    v-model="formEng.handoverUnit"
                    placeholder="请输入移交单位"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6"></el-col>
              <el-col :span="6"></el-col>
              <el-col :span="6"></el-col>
            </el-row>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitFormEng">确 定</el-button>
            <el-button @click="cancelEng">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 项目工程导入对话框 -->
        <el-dialog
          :title="uploadEng.title"
          :visible.sync="uploadEng.open"
          width="400px"
          append-to-body
        >
          <el-upload
            ref="uploadEng"
            :limit="1"
            accept=".xlsx, .xls"
            :headers="uploadEng.headers"
            :action="uploadEng.url"
            :disabled="uploadEng.isUploading"
            :on-progress="handleFileUploadProgressEng"
            :on-success="handleFileSuccessEng"
            :auto-upload="false"
            drag
          >
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">
              将文件拖到此处，或
              <em>点击上传</em>
            </div>
            <div class="el-upload__tip text-center" slot="tip">
              <span>仅允许导入xls、xlsx格式文件。</span>
              <el-link
                type="primary"
                :underline="false"
                style="font-size: 12px; vertical-align: baseline"
                @click="importTemplateEng"
                >下载模板</el-link
              >
            </div>
          </el-upload>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitFileFormEng"
              >确 定</el-button
            >
            <el-button @click="uploadEng.open = false">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 项目工程高级查询对话框 -->
        <el-dialog
          :title="heightEng.title"
          :visible.sync="heightEng.open"
          width="560px"
          append-to-body
        >
          <el-row type="flex" justify="space-between">
            <el-col :span="10">
              <el-select
                v-model="heightParam"
                filterable
                clearable
                placeholder="请选择字段"
              >
                <el-option
                  v-for="item in heightOptionEng"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
            <el-col :span="2">
              <div style="padding-left: 5px; padding-top: 7px">包含</div>
            </el-col>
            <el-col :span="10">
              <el-input v-model="heightValue" placeholder="请输入查询内容" />
            </el-col>
          </el-row>
          <el-row style="margin-top: 25px">
            <el-col :span="24">
              <el-form
                :model="queryParamsEng"
                ref="queryFormEng"
                :inline="true"
                v-show="showSearch"
                label-width="68px"
              >
                <el-form-item label="开工时间">
                  <el-date-picker
                    v-model="daterangeStartTime"
                    size="small"
                    style="width: 240px"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-form-item>
                <el-form-item label="竣工时间">
                  <el-date-picker
                    v-model="daterangeCompletTime"
                    size="small"
                    style="width: 240px"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-form-item>
              </el-form>
            </el-col>
          </el-row>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="getHeightEng">搜 索</el-button>
            <el-button @click="heightEng.open = false">取 消</el-button>
          </div>
        </el-dialog>

        <!--*****************************************案卷级***********************************-->
        <el-divider content-position="left">案卷级</el-divider>
        <!--案卷信息数据-->
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAddArch"
              v-hasPermi="['system:archives:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdateArch"
              v-hasPermi="['system:archives:edit']"
              v-if="isAdmin"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDeleteArch"
              v-hasPermi="['system:archives:remove']"
              v-if="isAdmin"
              >删除</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="info"
              plain
              icon="el-icon-upload2"
              size="mini"
              @click="handleImportArch"
              v-hasPermi="['system:archives:import']"
              >导入</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExportArch"
              v-hasPermi="['system:archives:export']"
              >导出</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="multiple"
              @click="handleApply"
              >归档申请</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="multiple"
              @click="handleApprove"
              v-if="isAdmin"
              >归档通过</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="multiple"
              @click="handleReject"
              v-if="isAdmin"
              >归档拒绝</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-download"
              size="mini"
              :disabled="multiple"
              @click="handlePrintBack"
              v-hasPermi="['system:file:list']"
              >打印背脊</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-search"
              size="mini"
              @click="handleHeighArch"
              v-hasPermi="['system:archives:list']"
              >高级查询</el-button
            >
          </el-col>
          <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getListArch"></right-toolbar> -->
        </el-row>

        <el-table
          :data="archivesList"
          @selection-change="handleSelectionChangeArch"
          highlight-current-row
          @current-change="handleCurrentChangeArch"
          border
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column
            label="单位工程名称"
            align="center"
            prop="rEngin.unitProjectName"
            min-width="300px"
            show-overflow-tooltip
          />
          <el-table-column
            label="总登记号"
            align="center"
            prop="registNum"
            show-overflow-tooltip
          />
          <el-table-column
            label="分类号"
            align="center"
            prop="archiveClassifiNum"
            show-overflow-tooltip
          />
          <el-table-column
            label="档号"
            align="center"
            prop="archiveFileNum"
            min-width="200px"
            show-overflow-tooltip
          />
          <el-table-column
            label="项目代号"
            align="center"
            prop="projectCode"
            min-width="200px"
            show-overflow-tooltip
          />
          <el-table-column
            label="案卷题名"
            align="center"
            prop="caseFileTitle"
            min-width="300px"
            show-overflow-tooltip
          />
          <el-table-column
            label="档案馆代号"
            align="center"
            prop="archiveCode"
            show-overflow-tooltip
          />
          <el-table-column
            label="案卷档号"
            align="center"
            prop="objStr3"
            show-overflow-tooltip
          />
          <el-table-column
            label="微缩号"
            align="center"
            prop="miniatureNum"
            show-overflow-tooltip
          />

          <el-table-column
            label="责任者"
            align="center"
            prop="personLiable"
            show-overflow-tooltip
          />
          <el-table-column
            label="编制日期"
            align="center"
            prop="compilationDate"
            width="180"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span>{{
                parseTime(scope.row.compilationDate, "{y}-{m}-{d}")
              }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="存放位置"
            align="center"
            prop="storagePosition"
          />
          <el-table-column
            label="编制单位"
            align="center"
            prop="organization"
            min-width="200px"
            show-overflow-tooltip
          />
          <el-table-column
            label="进馆日期"
            align="center"
            prop="entryDate"
            width="180"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.entryDate, "{y}-{m}-{d}") }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="总卷数"
            align="center"
            prop="totalRolls"
            show-overflow-tooltip
          />
          <el-table-column
            label="当前卷"
            align="center"
            prop="currentRolls"
            show-overflow-tooltip
          />
          <el-table-column
            label="保管期限"
            align="center"
            prop="storageTime"
            show-overflow-tooltip
          />
          <el-table-column
            label="移交单位"
            align="center"
            prop="objStr2"
            show-overflow-tooltip
          />
          <el-table-column
            label="密级"
            align="center"
            prop="secretLevel"
            show-overflow-tooltip
          />
          <el-table-column
            label="录入人"
            align="center"
            prop="objStr4"
            show-overflow-tooltip
          />
          <el-table-column label="实体借阅状态" align="center" prop="status">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.status == 0">未借出</el-tag>
              <el-tag type="danger" v-if="scope.row.status == 1">已借出</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            label="归档状态"
            align="center"
            prop="status"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-tag type="info" v-if="scope.row.objStr1 == 0">未申请</el-tag>
              <el-tag v-if="scope.row.objStr1 == 1">申请中</el-tag>
              <el-tag type="success" v-if="scope.row.objStr1 == 2"
                >已归档</el-tag
              >
              <el-tag type="danger" v-if="scope.row.objStr1 == 3"
                >审核拒绝</el-tag
              >
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
            width="120px"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdateArch(scope.row)"
                v-hasPermi="['system:archives:edit']"
                v-if="scope.row.objStr1 !== '2'"
                >修改</el-button
              >
              <el-dropdown
                size="mini"
                @command="(command) => handleCommandArch(command, scope.row)"
                v-hasPermi="[
                  'system:archives:remove',
                  'system:user:edit',
                  'system:file:export',
                ]"
              >
                <span class="el-dropdown-link">
                  <i class="el-icon-d-arrow-right el-icon--right"></i>更多
                </span>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item
                    command="handleAuthRole"
                    icon="el-icon-circle-check"
                    v-hasPermi="['system:user:edit']"
                    v-if="scope.row.objStr1 !== '2'"
                    >文件批量上传</el-dropdown-item
                  >
                  <el-dropdown-item
                    command="handlePrintCover"
                    icon="el-icon-circle-check"
                    >打印封皮</el-dropdown-item
                  >
                  <el-dropdown-item
                    command="handlePrintBkTable"
                    icon="el-icon-circle-check"
                    >打印备考表</el-dropdown-item
                  >
                  <el-dropdown-item
                    command="handlePrintAcceptance"
                    icon="el-icon-circle-check"
                    >打印验收清单</el-dropdown-item
                  >
                  <el-dropdown-item
                    command="anjuanbaoExport"
                    icon="el-icon-circle-check"
                    v-hasPermi="['system:file:export']"
                    >案卷包导出</el-dropdown-item
                  >
                  <el-dropdown-item
                    command="handleDeleteArch"
                    icon="el-icon-delete"
                    v-hasPermi="['system:archives:remove']"
                    v-if="scope.row.objStr1 !== '2'"
                    >删除</el-dropdown-item
                  >
                </el-dropdown-menu>
              </el-dropdown>
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="totalArch > 0"
          :total="totalArch"
          :page.sync="queryParamsArch.pageNum"
          :limit.sync="queryParamsArch.pageSize"
          @pagination="getListArch"
          :page-sizes="page_size"
        />

        <!-- 添加或修改案卷管理对话框 -->
        <el-dialog
          :title="archTitle"
          :visible.sync="archOpen"
          width="80%"
          append-to-body
        >
          <el-form
            ref="formArch"
            :model="formArch"
            :rules="rulesArch"
            label-width="80px"
          >
            <el-row>
              <el-col :span="6">
                <el-form-item label="单位工程名称" prop="enginId">
                  <el-select
                    v-model="formArch.enginId"
                    filterable
                    remote
                    :remote-method="remoteMethodEng"
                    clearable
                    loading-text="加载中..."
                    placeholder="请输入关键词"
                  >
                    <el-option
                      v-for="item in enginListOption"
                      :key="item.enginId"
                      :label="item.unitProjectName"
                      :value="item.enginId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="总登记号" prop="registNum">
                  <el-input
                    v-model="formArch.registNum"
                    placeholder="请输入案卷总登记号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="分类号" prop="archiveClassifiNum">
                  <el-input
                    v-model="formArch.archiveClassifiNum"
                    placeholder="请输入案卷分类号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="档号" prop="archiveFileNum">
                  <el-input
                    v-model="formArch.archiveFileNum"
                    placeholder="请输入档号"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="案卷题名" prop="caseFileTitle">
                  <el-input
                    type="textarea"
                    v-model="formArch.caseFileTitle"
                    placeholder="请输入案卷题名"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="项目代号" prop="projectCode">
                  <el-input
                    v-model="formArch.projectCode"
                    placeholder="请输入项目代号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="档案馆代号" prop="archiveCode">
                  <el-input
                    v-model="formArch.archiveCode"
                    placeholder="请输入档案馆代号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="保管期限" prop="storageTime">
                  <el-input
                    v-model="formArch.storageTime"
                    placeholder="请输入保管期限"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="责任者" prop="personLiable">
                  <el-input
                    v-model="formArch.personLiable"
                    placeholder="请输入责任者"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="编制日期" prop="compilationDate">
                  <el-date-picker
                    style="width: 170px"
                    clearable
                    size="small"
                    v-model="formArch.compilationDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择编制日期"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="移交单位" prop="objStr2">
                  <el-input
                    v-model="formArch.objStr2"
                    placeholder="请输入移交单位"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="存放位置" prop="storagePosition">
                  <el-input
                    v-model="formArch.storagePosition"
                    placeholder="请输入存放位置"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="编制单位" prop="organization">
                  <el-input
                    v-model="formArch.organization"
                    placeholder="请输入编制单位"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="进馆日期" prop="entryDate">
                  <el-date-picker
                    style="width: 170px"
                    clearable
                    size="small"
                    v-model="formArch.entryDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择进馆日期"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="总卷数" prop="totalRolls">
                  <el-input
                    v-model="formArch.totalRolls"
                    placeholder="请输入总卷数"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="当前卷" prop="currentRolls">
                  <el-input
                    v-model="formArch.currentRolls"
                    placeholder="请输入当前卷"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="微缩号" prop="miniatureNum">
                  <el-input
                    v-model="formArch.miniatureNum"
                    placeholder="请输入微缩号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="密级" prop="secretLevel">
                  <el-input
                    v-model="formArch.secretLevel"
                    placeholder="请输入密级"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="案卷档号" prop="objStr3">
                  <el-input
                    v-model="formArch.objStr3"
                    placeholder="请输入案卷档号"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitFormArch">确 定</el-button>
            <el-button @click="cancelArch">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 案卷导入对话框 -->
        <el-dialog
          :title="uploadArch.title"
          :visible.sync="uploadArch.open"
          width="400px"
          append-to-body
        >
          <el-upload
            ref="uploadArch"
            :limit="1"
            accept=".xlsx, .xls"
            :headers="uploadArch.headers"
            :action="uploadArch.url"
            :disabled="uploadArch.isUploading"
            :on-progress="handleFileUploadProgressArch"
            :on-success="handleFileSuccessArch"
            :auto-upload="false"
            drag
          >
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">
              将文件拖到此处，或
              <em>点击上传</em>
            </div>
            <div class="el-upload__tip text-center" slot="tip">
              <span>仅允许导入xls、xlsx格式文件。</span>
              <el-link
                type="primary"
                :underline="false"
                style="font-size: 12px; vertical-align: baseline"
                @click="importTemplateArch"
                >下载模板</el-link
              >
            </div>
          </el-upload>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitFileFormArch"
              >确 定</el-button
            >
            <el-button @click="uploadArch.open = false">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 案卷高级查询对话框 -->
        <el-dialog
          :title="heightArch.title"
          :visible.sync="heightArch.open"
          width="560px"
          append-to-body
        >
          <el-row type="flex" justify="space-between">
            <el-col :span="10">
              <el-select
                v-model="heightParam"
                filterable
                clearable
                placeholder="请选择字段"
              >
                <el-option
                  v-for="item in heightOptionArch"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
            <el-col :span="2">
              <div style="padding-left: 5px; padding-top: 7px">包含</div>
            </el-col>
            <el-col :span="10">
              <el-input v-model="heightValue" placeholder="请输入查询内容" />
            </el-col>
          </el-row>
          <el-row style="margin-top: 25px">
            <el-col :span="24">
              <el-form
                :model="queryParamsArch"
                ref="queryFormArch"
                :inline="true"
                v-show="showSearch"
                label-width="68px"
              >
                <el-form-item label="归档状态">
                  <el-select
                    v-model="queryParamsArch.objStr1"
                    filterable
                    clearable
                    placeholder="请选择归档状态"
                  >
                    <el-option
                      v-for="item in heightOptionFinish"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="编制日期">
                  <el-date-picker
                    v-model="daterangeCompilationDate"
                    size="small"
                    style="width: 240px"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    unlink-panels
                  ></el-date-picker>
                </el-form-item>
                <el-form-item label="进馆日期">
                  <el-date-picker
                    v-model="daterangeEntryDate"
                    size="small"
                    style="width: 240px"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    unlink-panels
                  ></el-date-picker>
                </el-form-item>
              </el-form>
            </el-col>
          </el-row>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="getHeightArch">搜 索</el-button>
            <el-button @click="heightArch.open = false">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 案卷封皮 -->
        <div id="cover-book" class="box">
          <table>
            <tr>
              <td>
                <div style="margin-top: 30px"></div>
              </td>
            </tr>
            <tr>
              <td class="w-20">
                分类号&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.archiveClassifiNum }}</u>
              </td>
              <td class="w-20">
                档案馆代号&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.archiveCode }}</u>
              </td>
            </tr>
            <tr>
              <td class="w-20">
                档号&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.archiveFileNum }}</u>
              </td>
              <td class="w-20">
                微缩号&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.miniatureNum }}</u>
              </td>
            </tr>
            <tr>
              <td class="w-20"></td>
              <td class="w-20">
                项目代号&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.projectCode }}</u>
              </td>
            </tr>
            <tr>
              <td>
                <div style="margin-top: 600px"></div>
              </td>
            </tr>
            <tr>
              <td>
                案卷题名：&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.caseFileTitle }}</u>
              </td>
            </tr>
            <tr>
              <td>
                责任者&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.personLiable }}</u>
              </td>
            </tr>
            <tr>
              <td>
                编制日期：&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.compilationDate }}</u>
              </td>
            </tr>
            <tr>
              <td>
                移交单位&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.objStr2 }}</u>
              </td>
            </tr>
            <tr>
              <td class="w-20">
                密级&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.secretLevel }}</u>
              </td>
              <td class="w-20">
                保管期限&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.storageTime }}</u>
              </td>
            </tr>
            <tr>
              <td class="w-20">
                共&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.totalRolls }}卷</u>
              </td>
              <td class="w-20">
                第&nbsp;&nbsp;&nbsp;&nbsp;
                <u>{{ coverData.currentRolls }}卷</u>
              </td>
            </tr>
            <tr>
              <td>
                总登记号&nbsp&nbsp&nbsp&nbsp
                <u>{{ coverData.registNum }}</u>
              </td>
            </tr>
          </table>
        </div>

        <!--*****************************************文件级***********************************-->
        <el-divider content-position="left">文件级</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAddFile"
              v-hasPermi="['system:file:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdateFile"
              v-hasPermi="['system:file:edit']"
              v-if="isAdmin"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="multiple"
              @click="handleDeleteFile"
              v-hasPermi="['system:file:remove']"
              v-if="isAdmin"
              >删除</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="info"
              plain
              icon="el-icon-upload2"
              size="mini"
              @click="handleImportFile"
              v-hasPermi="['system:file:import']"
              >导入</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-edit"
              size="mini"
              @click="handleExportFile"
              v-hasPermi="['system:file:export']"
              >导出</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handlePrintMenu"
              v-hasPermi="['system:file:list']"
              >打印</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-search"
              size="mini"
              @click="handleHeighFile"
              v-hasPermi="['system:file:list']"
              >高级查询</el-button
            >
          </el-col>
        </el-row>
        <el-table
          :data="fileList"
          @selection-change="handleSelectionChangeFile"
          border
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column
            label="案卷题名"
            align="center"
            prop="archives.caseFileTitle"
            min-width="300px"
            show-overflow-tooltip
          />
          <el-table-column
            label="顺序号"
            align="center"
            prop="sequenceNum"
            show-overflow-tooltip
          />
          <el-table-column
            label="文件编号"
            align="center"
            prop="fileNo"
            show-overflow-tooltip
          />
          <el-table-column
            label="文件题名"
            align="center"
            prop="docTitle"
            min-width="300px"
            show-overflow-tooltip
          />
          <el-table-column
            label="责任者"
            align="center"
            prop="objStr1"
            show-overflow-tooltip
          />
          <el-table-column
            label="档号"
            align="center"
            prop="objStr2"
            min-width="200px"
            show-overflow-tooltip
          />
          <el-table-column
            label="文图号"
            align="center"
            prop="objStr3"
            show-overflow-tooltip
          />
          <el-table-column
            label="载体类型"
            align="center"
            prop="objStr4"
            show-overflow-tooltip
          />
          <el-table-column
            label="页数"
            align="center"
            prop="pageCounts"
            show-overflow-tooltip
          />
          <el-table-column
            label="页号"
            align="center"
            prop="pageNo"
            show-overflow-tooltip
          />
          <el-table-column
            label="备注"
            align="center"
            prop="remark"
            min-width="300px"
            show-overflow-tooltip
          />
          <el-table-column
            label="文件"
            align="center"
            prop="filePath"
            min-width="300px"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <el-tag type="info" v-if="scope.row.filePath == null"
                >无文件</el-tag
              >
              <div v-if="scope.row.filePath != null">
                <li
                  :key="path"
                  class="el-upload-list__item ele-upload-list__item-content"
                  v-for="path in getFilePath(scope.row.filePath)"
                >
                  <el-link :href="path" :underline="false" target="_blank">
                    <span class="el-icon-document">{{
                      getFileName(path)
                    }}</span>
                  </el-link>
                </li>
              </div>
            </template>
          </el-table-column>
          <el-table-column
            label="图片"
            align="center"
            prop="imgPath"
            width="100"
          >
            <template slot-scope="scope">
              <el-tag type="info" v-if="scope.row.imgPath == null"
                >无图片</el-tag
              >
              <image-preview
                v-if="scope.row.imgPath != null"
                :src="scope.row.imgPath"
                :width="50"
                :height="50"
              />
              <el-tag
                v-if="scope.row.imgPath != null"
                type="success"
                class="point"
                @click="printImage(scope.row.imgPath)"
                >打印</el-tag
              >
            </template>
          </el-table-column>
          <el-table-column
            label="创建时间"
            align="center"
            prop="createTime"
            show-overflow-tooltip
          />
          <el-table-column
            label="更新时间"
            align="center"
            prop="updateTime"
            show-overflow-tooltip
          />
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
            width="120px"
            fixed="right"
          >
            <template
              slot-scope="scope"
              v-if="scope.row.archives.objStr1 !== '2'"
            >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdateFile(scope.row)"
                v-hasPermi="['system:file:edit']"
                >修改</el-button
              >
              <el-dropdown
                size="mini"
                @command="(command) => handleCommandFile(command, scope.row)"
                v-hasPermi="['system:file:remove', 'system:user:edit']"
              >
                <span class="el-dropdown-link">
                  <i class="el-icon-d-arrow-right el-icon--right"></i>更多
                </span>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item
                    command="handleDeleteFile"
                    icon="el-icon-delete"
                    v-hasPermi="['system:file:remove']"
                    >删除</el-dropdown-item
                  >
                  <el-dropdown-item
                    command="handleAuthRole"
                    icon="el-icon-circle-check"
                    v-hasPermi="['system:user:edit']"
                    >分配角色</el-dropdown-item
                  >
                </el-dropdown-menu>
              </el-dropdown>
            </template>
          </el-table-column>
        </el-table>

        <!-- 添加或修改文件管理对话框 -->
        <el-dialog
          :title="titleFile"
          :visible.sync="openFile"
          width="80%"
          append-to-body
        >
          <el-form
            ref="formFile"
            :model="formFile"
            :rules="rulesFile"
            label-width="80px"
          >
            <el-row>
              <el-col :span="6">
                <el-form-item label="案卷题名" prop="archivesId">
                  <el-select
                    v-model="formFile.archivesId"
                    filterable
                    remote
                    :remote-method="remoteMethodArch"
                    automatic-dropdown
                    clearable
                    loading-text="加载中..."
                    placeholder="请输入关键词"
                  >
                    <el-option
                      v-for="item in archivesListOption"
                      :key="item.archivesId"
                      :label="item.caseFileTitle"
                      :value="item.archivesId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="顺序号" prop="sequenceNum">
                  <el-input
                    v-model="formFile.sequenceNum"
                    placeholder="请输入顺序号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="文件编号" prop="fileNo">
                  <el-input
                    v-model="formFile.fileNo"
                    placeholder="请输入文件编号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="文件题名" prop="docTitle">
                  <el-input
                    type="textarea"
                    v-model="formFile.docTitle"
                    placeholder="请输入文件题名"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="档号" prop="objStr2">
                  <el-input
                    v-model="formFile.objStr2"
                    placeholder="请输入档号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="文图号" prop="objStr3">
                  <el-input
                    v-model="formFile.objStr3"
                    placeholder="请输入文图号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="载体类型" prop="objStr4">
                  <el-input
                    v-model="formFile.objStr4"
                    placeholder="请输入载体类型"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="责任者" prop="objStr1">
                  <el-input
                    v-model="formFile.objStr1"
                    placeholder="请输入责任者"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="页数" prop="pageCounts">
                  <el-input
                    v-model="formFile.pageCounts"
                    placeholder="请输入页数"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="页号" prop="pageNo">
                  <el-input
                    v-model="formFile.pageNo"
                    placeholder="请输入页号"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="备注" prop="remark">
                  <el-input
                    v-model="formFile.remark"
                    type="textarea"
                    placeholder="请输入内容"
                  />
                </el-form-item>
              </el-col>
            </el-row>

            <el-form-item label="图片上传" prop="imgPath">
              <file-upload
                v-model="formFile.imgPath"
                :fileType="imgType"
                :data="formFile.archivesId"
              />
              <!-- <image-upload v-model="formFile.imgPath" /> -->
            </el-form-item>
            <el-form-item label="文件上传" prop="filePath">
              <file-upload
                v-model="formFile.filePath"
                :data="formFile.archivesId"
              />
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitFormFile">确 定</el-button>
            <el-button @click="cancelFile">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 文件导入对话框 -->
        <el-dialog
          :title="uploadFile.title"
          :visible.sync="uploadFile.open"
          width="400px"
          append-to-body
        >
          <el-upload
            ref="uploadFile"
            :limit="1"
            accept=".xlsx, .xls"
            :headers="uploadFile.headers"
            :action="uploadFile.url"
            :disabled="uploadFile.isUploading"
            :on-progress="handleFileUploadProgressFile"
            :on-success="handleFileSuccessFile"
            :auto-upload="false"
            drag
          >
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">
              将文件拖到此处，或
              <em>点击上传</em>
            </div>
            <div class="el-upload__tip text-center" slot="tip">
              <span>仅允许导入xls、xlsx格式文件。</span>
              <el-link
                type="primary"
                :underline="false"
                style="font-size: 12px; vertical-align: baseline"
                @click="importTemplateFile"
                >下载模板</el-link
              >
            </div>
          </el-upload>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitFileFormFile"
              >确 定</el-button
            >
            <el-button @click="uploadFile.open = false">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 文件高级查询对话框 -->
        <el-dialog
          :title="heightFile.title"
          :visible.sync="heightFile.open"
          width="560px"
          append-to-body
        >
          <el-row type="flex" justify="space-between">
            <el-col :span="10">
              <el-select
                v-model="heightParam"
                filterable
                clearable
                placeholder="请选择字段"
              >
                <el-option
                  v-for="item in heightOptionFile"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
            <el-col :span="2">
              <div style="padding-left: 5px; padding-top: 7px">包含</div>
            </el-col>
            <el-col :span="10">
              <el-input v-model="heightValue" placeholder="请输入查询内容" />
            </el-col>
          </el-row>
          <el-row style="margin-top: 25px">
            <el-col :span="24">
              <el-form
                :model="queryParamsFile"
                ref="queryFormFile"
                :inline="true"
                v-show="showSearch"
                label-width="68px"
              ></el-form>
            </el-col>
          </el-row>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="getHeightFile">搜 索</el-button>
            <el-button @click="heightFile.open = false">取 消</el-button>
          </div>
        </el-dialog>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {
  listArchivesByName,
  listArchives,
  getArchives,
  delArchives,
  addArchives,
  updateArchives,
  updateArchivesApply,
  updateArchivesApprove,
  updateArchivesReject,
} from "@/api/system/archives";
import { treeselect, getType } from "@/api/system/type";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getToken } from "@/utils/auth";
import print from "print-js";

import {
  listFile,
  getFile,
  delFile,
  addFile,
  updateFile,
} from "@/api/system/file";

import {
  listEnginByName,
  listEngin,
  getEngin,
  delEngin,
  addEngin,
  updateEngin,
} from "@/api/system/engin";
import { getInfo } from "@/api/login";

export default {
  name: "Archives",
  components: { Treeselect },
  data() {
    return {
      imgType: ["png", "jpg", "jpeg"],
      uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
      // 项目根路径
      baseUrl: process.env.VUE_APP_BASE_API,
      // 类别名称
      typeName: undefined,
      // 档案分类表格数据
      typeOptions: undefined,
      typeOptionsEng: undefined,
      typeOptionsArch: undefined,
      // 查询可用状态类别参数
      defaultProps: {
        children: "children",
        label: "label",
      },
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 分页器每页显示
      page_size: [5, 10, 15, 20, 25, 30, 100],
      // 高级查询值
      heightValue: null,
      // 高级查询参数
      heightParam: null,
      // 判断是否超级管理员
      isAdmin: false,
      // 类型参数
      queryType: {
        status: "0",
      },
      /******************项目工程级********************/
      // 选中数组
      idsEng: [],
      // 总条数
      totalEng: 0,
      // 项目工程管理表格数据
      enginList: [],
      // 项目工程管理表格数据，添加
      enginListAdd: [],
      // 弹出层标题
      titleEng: "",
      // 是否显示弹出层
      openEng: false,
      // 预留字段15时间范围
      daterangeStartTime: [],
      // 预留字段15时间范围
      daterangeCompletTime: [],
      // 预留字段15时间范围
      daterangeEntryDate: [],
      // 预留字段15时间范围
      daterangeCreateTime: [],
      // 预留字段15时间范围
      daterangeUpdateTime: [],
      // 查询参数
      queryParamsEng: {
        pageNum: 1,
        pageSize: 5,
        enginClassifiNum: null,
        enginFileNum: null,
        enginName: null,
        unitProjectName: null,
        projectLocation: null,
        buildUnit: null,
        constructiUnit: null,
        projectApproveUnit: null,
        designUnit: null,
        surveyUnit: null,
        supervUnit: null,
        qualitySupervUnit: null,
        projectApprovalNum: null,
        enginplanPermitNum: null,
        landplanPermitNum: null,
        landusePermitNum: null,
        constructiPermitNum: null,
        planPermitNum: null,
        totalLandArea: null,
        totalBuildArea: null,
        buildArea: null,
        startTime: null,
        completTime: null,
        projectBudget: null,
        projectFinalAccounts: null,
        filesCounts: null,
        textVolumes: null,
        drawCounts: null,
        storageTime: null,
        secretLevel: null,
        entryDate: null,
        handoverUnit: null,
        typeId: null,
        createTime: null,
        updateTime: null,
        createBy: null,
        updateBy: null,
      },
      // 高级查询参数
      heightEng: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
      },
      // 高级查询字段参数选项
      heightOptionEng: [
        {
          label: "工程分类号",
          value: "enginClassifiNum",
        },
        {
          label: "档号",
          value: "enginFileNum",
        },
        {
          label: "工程名称",
          value: "enginName",
        },
        {
          label: "单位工程名称",
          value: "unitProjectName",
        },
        {
          label: "工程地点",
          value: "projectLocation",
        },
        {
          label: "建设单位",
          value: "buildUnit",
        },
        {
          label: "施工单位",
          value: "constructiUnit",
        },
        {
          label: "立项批准单位",
          value: "projectApproveUnit",
        },
        {
          label: "设计单位",
          value: "designUnit",
        },
        {
          label: "勘察单位",
          value: "surveyUnit",
        },
        {
          label: "监理单位",
          value: "supervUnit",
        },
        {
          label: "质量安全监督单位",
          value: "qualitySupervUnit",
        },
        {
          label: "立项批准文",
          value: "projectApprovalNum",
        },
        {
          label: "工程规划许可证号",
          value: "enginplanPermitNum",
        },
        {
          label: "用地规划许可证号",
          value: "landplanPermitNum",
        },
        {
          label: "用地许可证号",
          value: "landusePermitNum",
        },
        {
          label: "施工许可证号",
          value: "constructiPermitNum",
        },
        {
          label: "规划许可证号",
          value: "planPermitNum",
        },
        {
          label: "总用地面积",
          value: "totalLandArea",
        },
        {
          label: "总建筑面积",
          value: "totalBuildArea",
        },
        {
          label: "建筑面积",
          value: "buildArea",
        },
        {
          label: "工程预算",
          value: "projectBudget",
        },
        {
          label: "工程决算",
          value: "projectFinalAccounts",
        },
        {
          label: "案卷数",
          value: "filesCounts",
        },
        {
          label: "文字卷数",
          value: "textVolumes",
        },
        {
          label: "图纸卷数",
          value: "drawCounts",
        },
        {
          label: "密级",
          value: "secretLevel",
        },
        {
          label: "移交单位",
          value: "handoverUnit",
        },
      ],
      // 表单参数
      formEng: {},
      // 表单校验
      rulesEng: {
        typeId: [
          { required: true, message: "类别不能为空", trigger: "change" },
        ],
        enginName: [
          { required: true, message: "工程名称不能为空", trigger: "blur" },
        ],
      },
      // 项目工程导入参数
      uploadEng: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/system/engin/importData",
      },
      /********************************************案卷级**********************************/
      // 选中数组
      archIds: [],
      // 总条数
      totalArch: 0,
      // 案卷管理表格数据
      archivesList: [],
      // 新增案卷，工程下拉菜单
      enginListOption: [],
      // 弹出层标题
      archTitle: "",
      // 是否显示弹出层
      archOpen: false,
      // 预留字段15时间范围
      daterangeCompilationDate: [],
      // 预留字段15时间范围
      daterangeEntryDate: [],
      // 查询参数
      queryParamsArch: {
        pageNum: 1,
        pageSize: 5,
        archiveClassifiNum: null,
        archiveFileNum: null,
        archiveCode: null,
        caseFileTitle: null,
        miniatureNum: null,
        projectCode: null,
        personLiable: null,
        compilationDate: null,
        registNum: 0,
        storagePosition: null,
        organization: null,
        entryDate: null,
        totalRolls: null,
        currentRolls: null,
        storageTime: null,
        secretLevel: null,
        enginId: null,
        status: null,
        typeId: null,
        createTime: null,
        updateTime: null,
        createBy: null,
        updateBy: null,
        objStr1: null,
        objStr2: null,
      },
      // 封皮参数
      coverData: {
        archiveClassifiNum: null,
        archiveFileNum: null,
        archiveCode: null,
        caseFileTitle: null,
        miniatureNum: null,
        projectCode: null,
        personLiable: null,
        compilationDate: null,
        registNum: null,
        storagePosition: null,
        organization: null,
        entryDate: null,
        totalRolls: null,
        currentRolls: null,
        storageTime: null,
        secretLevel: null,
        objStr2: null,
      },
      // 高级查询参数
      heightArch: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
      },
      // 高级查询字段参数选项
      heightOptionArch: [
        {
          label: "案卷分类号",
          value: "archiveClassifiNum",
        },
        {
          label: "档号",
          value: "archiveFileNum",
        },
        {
          label: "档案馆代号",
          value: "archiveCode",
        },
        {
          label: "案卷题名",
          value: "caseFileTitle",
        },
        {
          label: "微缩号",
          value: "miniatureNum",
        },
        {
          label: "项目代号",
          value: "projectCode",
        },
        {
          label: "责任者",
          value: "personLiable",
        },
        {
          label: "总登记号",
          value: "registNum",
        },
        {
          label: "存放位置",
          value: "storagePosition",
        },
        {
          label: "编制单位",
          value: "organization",
        },
        {
          label: "总卷数",
          value: "totalRolls",
        },
        {
          label: "当前卷",
          value: "currentRolls",
        },
        {
          label: "密级",
          value: "secretLevel",
        },
        {
          label: "移交单位",
          value: "objStr2",
        },
      ],
      // 归档选项
      heightOptionFinish: [
        {
          label: "未申请",
          value: "0",
        },
        {
          label: "申请中",
          value: "1",
        },
        {
          label: "审核通过",
          value: "2",
        },
        {
          label: "审核拒绝",
          value: "3",
        },
      ],
      // 表单参数
      formArch: {},
      // 表单校验
      rulesArch: {
        typeId: [
          { required: true, message: "类别不能为空", trigger: "change" },
        ],
        enginId: [
          { required: true, message: "工程名称不能为空", trigger: "change" },
        ],
        caseFileTitle: [
          { required: true, message: "案卷题名不能为空", trigger: "blur" },
        ],
        registNum: [
          { required: true, message: "总登记号不能为空", trigger: "blur" },
        ],
      },
      // 案卷导入参数
      uploadArch: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/system/archives/importData",
      },
      /******************文件级********************/
      // 测试数据
      test: "123BN",
      // 选中数组
      fileIds: [],
      // 总条数
      totalFile: 0,
      // 文件管理表格数据
      fileList: [],
      // 新增文件，案卷题名下拉
      archivesListOption: [],
      // 弹出层标题
      titleFile: "",
      // 是否显示弹出层
      openFile: false,
      // 预留字段10时间范围
      daterangeCreateTime: [],
      // 预留字段10时间范围
      daterangeUpdateTime: [],
      // 查询参数，不分页
      queryParamsFile: {
        sequenceNum: null,
        fileNo: null,
        docTitle: null,
        objStr1: null,
        pageCounts: null,
        pageNo: null,
        archivesId: null,
        filePath: null,
        imgPath: null,
        fileExt: null,
        createTime: null,
        updateTime: null,
        createBy: null,
        updateBy: null,
      },
      // 高级查询参数
      heightFile: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
      },
      // 高级查询字段参数选项
      heightOptionFile: [
        {
          label: "顺序号",
          value: "sequenceNum",
        },
        {
          label: "文件编号",
          value: "fileNo",
        },
        {
          label: "文件题名",
          value: "docTitle",
        },
        {
          label: "责任者",
          value: "objStr1",
        },
        {
          label: "页数",
          value: "pageCounts",
        },
        {
          label: "页号",
          value: "pageNo",
        },
      ],
      // 表单参数
      formFile: {},
      // 表单校验
      rulesFile: {
        archivesId: [
          { required: true, message: "案卷题名不能为空", trigger: "change" },
        ],
        docTitle: [
          { required: true, message: "文件题名不能为空", trigger: "blur" },
        ],
      },
      // 文件导入参数
      uploadFile: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/system/file/importData",
      },
    };
  },
  /**************************js部分*************************/
  created() {
    //this.getListEng();
    //this.getListArch();
    //this.getListFile();
    this.getTreeselect();
    this.getTreeselectEng();
    this.getTreeselectArch();
    // 判断是否超级管理员或管理员
    getInfo().then((res) => {
      for (let i in res.roles) {
        if (res.roles[i] === "admin" || res.roles[i] === "record_admin") {
          this.isAdmin = true;
          break;
        }
      }
    });
  },
  watch: {
    // 根据名称筛选类别树
    typeName(val) {
      this.$refs.tree.filter(val);
    },
  },
  methods: {
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    // 节点单击事件
    handleNodeClick(data) {
      getType(data.id).then((response) => {
        if (response.data.parentId == 0) {
          // 顶层项目默认案卷级，其它默认项目级
          // 案卷级
          this.resetQueryArch();
          this.queryParamsArch.typeId = data.id;
          this.enginList = []; // 清空项目列表
          this.fileList = []; // 清空文件列表
          listArchives(this.queryParamsArch).then((response) => {
            this.archivesList = response.rows;
            this.totalArch = response.total;
          });
        } else {
          // 项目级
          this.resetQueryEng();
          this.queryParamsEng.typeId = data.id;
          this.archivesList = []; // 清空案卷列表
          this.fileList = []; // 清空文件列表
          listEngin(this.queryParamsEng).then((response) => {
            this.enginList = response.rows;
            this.totalEng = response.total;
          });
        }
      });
    },
    /** 获取左侧树形菜单结构数据 */
    getTreeselect() {
      treeselect({ status: "0" }).then((response) => {
        this.typeOptions = response.data;
      });
    },
    /** 获取项目级新增树形菜单结构数据 */
    getTreeselectEng() {
      this.queryType.params = {};
      this.queryType.params["isArch"] = "0";
      treeselect(this.queryType).then((response) => {
        this.typeOptionsEng = response.data;
      });
    },
    /** 获取项目级新增树形菜单结构数据 */
    getTreeselectArch() {
      this.queryType.params = {};
      this.queryType.params["isArch"] = "1";
      treeselect(this.queryType).then((response) => {
        this.typeOptionsArch = response.data;
      });
    },

    /******************项目工程级********************/
    // 单选
    handleCurrentChangeEng(val) {
      if (val != null) {
        this.resetQueryArch();
        this.queryParamsArch.enginId = val.enginId;
        this.queryParamsArch.typeId = null; // 清空类别
        listArchives(this.queryParamsArch).then((response) => {
          this.archivesList = response.rows;
          this.totalArch = response.total;
        });
        this.fileList = []; // 清空文件列表
      }
    },
    /** 查询项目工程管理列表 */
    getListEng() {
      this.queryParamsEng.params = {};
      if (null != this.daterangeStartTime && "" != this.daterangeStartTime) {
        this.queryParamsEng.params["beginStartTime"] =
          this.daterangeStartTime[0];
        this.queryParamsEng.params["endStartTime"] = this.daterangeStartTime[1];
      }
      if (
        null != this.daterangeCompletTime &&
        "" != this.daterangeCompletTime
      ) {
        this.queryParamsEng.params["beginCompletTime"] =
          this.daterangeCompletTime[0];
        this.queryParamsEng.params["endCompletTime"] =
          this.daterangeCompletTime[1];
      }
      if (null != this.daterangeEntryDate && "" != this.daterangeEntryDate) {
        this.queryParamsEng.params["beginEntryDate"] =
          this.daterangeEntryDate[0];
        this.queryParamsEng.params["endEntryDate"] = this.daterangeEntryDate[1];
      }
      if (null != this.daterangeCreateTime && "" != this.daterangeCreateTime) {
        this.queryParamsEng.params["beginCreateTime"] =
          this.daterangeCreateTime[0];
        this.queryParamsEng.params["endCreateTime"] =
          this.daterangeCreateTime[1];
      }
      if (null != this.daterangeUpdateTime && "" != this.daterangeUpdateTime) {
        this.queryParamsEng.params["beginUpdateTime"] =
          this.daterangeUpdateTime[0];
        this.queryParamsEng.params["endUpdateTime"] =
          this.daterangeUpdateTime[1];
      }
      listEngin(this.queryParamsEng).then((response) => {
        this.enginList = response.rows;
        this.totalEng = response.total;
      });
    },
    // 取消按钮
    cancelEng() {
      this.openEng = false;
      this.resetEng();
    },
    // 表单重置
    resetEng() {
      this.formEng = {
        enginId: null,
        enginClassifiNum: null,
        enginFileNum: null,
        enginName: null,
        unitProjectName: null,
        projectLocation: null,
        buildUnit: null,
        constructiUnit: null,
        projectApproveUnit: null,
        designUnit: null,
        surveyUnit: null,
        supervUnit: null,
        qualitySupervUnit: null,
        projectApprovalNum: null,
        enginplanPermitNum: null,
        landplanPermitNum: null,
        landusePermitNum: null,
        constructiPermitNum: null,
        planPermitNum: null,
        totalLandArea: null,
        totalBuildArea: null,
        buildArea: null,
        startTime: null,
        completTime: null,
        projectBudget: null,
        projectFinalAccounts: null,
        filesCounts: null,
        textVolumes: null,
        drawCounts: null,
        storageTime: null,
        secretLevel: null,
        entryDate: null,
        handoverUnit: null,
        typeId: null,
        createTime: null,
        updateTime: null,
        createBy: null,
        updateBy: null,
      };
      this.resetForm("formEng");
    },
    /** 搜索按钮操作 */
    handleQueryEng() {
      this.queryParamsEng.pageNum = 1;
      this.getListEng();
    },
    /** 重置按钮操作 */
    resetQueryEng() {
      this.daterangeStartTime = [];
      this.daterangeCompletTime = [];
      this.daterangeEntryDate = [];
      this.daterangeCreateTime = [];
      this.daterangeUpdateTime = [];
      (this.queryParamsEng.enginClassifiNum = null),
        (this.queryParamsEng.enginFileNum = null),
        (this.queryParamsEng.enginName = null),
        (this.queryParamsEng.unitProjectName = null),
        (this.queryParamsEng.projectLocation = null),
        (this.queryParamsEng.buildUnit = null),
        (this.queryParamsEng.constructiUnit = null),
        (this.queryParamsEng.projectApproveUnit = null),
        (this.queryParamsEng.designUnit = null),
        (this.queryParamsEng.surveyUnit = null),
        (this.queryParamsEng.supervUnit = null),
        (this.queryParamsEng.qualitySupervUnit = null),
        (this.queryParamsEng.projectApprovalNum = null),
        (this.queryParamsEng.enginplanPermitNum = null),
        (this.queryParamsEng.landplanPermitNum = null),
        (this.queryParamsEng.landusePermitNum = null),
        (this.queryParamsEng.constructiPermitNum = null),
        (this.queryParamsEng.planPermitNum = null),
        (this.queryParamsEng.totalLandArea = null),
        (this.queryParamsEng.totalBuildArea = null),
        (this.queryParamsEng.buildArea = null),
        (this.queryParamsEng.startTime = null),
        (this.queryParamsEng.completTime = null),
        (this.queryParamsEng.projectBudget = null),
        (this.queryParamsEng.projectFinalAccounts = null),
        (this.queryParamsEng.filesCounts = null),
        (this.queryParamsEng.textVolumes = null),
        (this.queryParamsEng.drawCounts = null),
        (this.queryParamsEng.storageTime = null),
        (this.queryParamsEng.secretLevel = null),
        (this.queryParamsEng.entryDate = null),
        (this.queryParamsEng.handoverUnit = null),
        (this.queryParamsEng.createTime = null),
        (this.queryParamsEng.updateTime = null),
        (this.queryParamsEng.createBy = null),
        (this.queryParamsEng.updateBy = null),
        this.resetForm("queryFormEng");
    },
    // 多选框选中数据
    handleSelectionChangeEng(selection) {
      this.idsEng = selection.map((item) => item.enginId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAddEng() {
      this.resetEng();
      this.openEng = true;
      this.titleEng = "添加项目工程管理";
    },
    /** 修改按钮操作 */
    handleUpdateEng(row) {
      this.resetEng();
      const enginId = row.enginId || this.idsEng;
      getEngin(enginId).then((response) => {
        this.formEng = response.data;
        this.openEng = true;
        this.titleEng = "修改项目工程管理";
      });
    },
    /** 提交按钮 */
    submitFormEng() {
      this.$refs["formEng"].validate((valid) => {
        if (valid) {
          if (this.formEng.enginId != null) {
            updateEngin(this.formEng).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.openEng = false;
              this.getListEng();
            });
          } else {
            addEngin(this.formEng).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.openEng = false;
              this.getListEng();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDeleteEng(row) {
      const enginIds = row.enginId || this.idsEng;
      this.$modal
        .confirm('是否确认删除项目工程管理编号为"' + enginIds + '"的数据项？')
        .then(function () {
          return delEngin(enginIds);
        })
        .then(() => {
          this.getListEng();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 高级查询按钮操作 */
    handleHeighEng() {
      this.heightEng.title = "项目工程高级查询";
      this.heightEng.open = true;
      this.resetQueryEng(); // 重置参数
    },
    /** 高级查询 */
    getHeightEng() {
      for (let key in this.queryParamsEng) {
        if (key === this.heightParam) {
          this.queryParamsEng[key] = this.heightValue;
        }
      }
      this.queryParamsEng.pageNum = 1;
      // this.queryParamsEng.typeId = null; // 清除类别干扰，查询所有
      this.archivesList = []; // 清空案卷列表
      this.fileList = []; // 清空文件列表
      this.getListEng();
      this.heightValue = null;
      this.heightParam = null;
      this.heightEng.open = false;
    },
    /** 导出按钮操作 */
    handleExportEng() {
      this.download(
        "system/engin/export",
        {
          ...this.queryParamsEng,
        },
        `engin_${new Date().getTime()}.xlsx`
      );
    },
    /** 导入按钮操作 */
    handleImportEng() {
      this.uploadEng.title = "项目工程导入";
      this.uploadEng.open = true;
    },
    /** 下载模板操作 */
    importTemplateEng() {
      this.download(
        "system/engin/importTemplate",
        {},
        `engin_template_${new Date().getTime()}.xlsx`
      );
    },
    // 文件上传中处理
    handleFileUploadProgressEng(event, file, fileList) {
      this.uploadEng.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccessEng(response, file, fileList) {
      this.uploadEng.open = false;
      this.uploadEng.isUploading = false;
      this.$refs.uploadEng.clearFiles();
      this.$alert(
        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
          response.msg +
          "</div>",
        "导入结果",
        { dangerouslyUseHTMLString: true }
      );
      this.getListEng();
    },
    // 提交上传文件
    submitFileFormEng() {
      this.$refs.uploadEng.submit();
    },
    /*******************************案卷级*************************/
    // 单选
    handleCurrentChangeArch(val) {
      if (val != null) {
        this.resetQueryFile();
        this.queryParamsFile.archivesId = val.archivesId;
        listFile(this.queryParamsFile).then((response) => {
          this.fileList = response.rows;
          this.totalFile = response.total;
        });
      }
    },
    /** 查询案卷管理列表 */
    getListArch() {
      this.queryParamsArch.params = {};
      if (
        null != this.daterangeCompilationDate &&
        "" != this.daterangeCompilationDate
      ) {
        this.queryParamsArch.params["beginCompilationDate"] =
          this.daterangeCompilationDate[0];
        this.queryParamsArch.params["endCompilationDate"] =
          this.daterangeCompilationDate[1];
      }
      if (null != this.daterangeEntryDate && "" != this.daterangeEntryDate) {
        this.queryParamsArch.params["beginEntryDate"] =
          this.daterangeEntryDate[0];
        this.queryParamsArch.params["endEntryDate"] =
          this.daterangeEntryDate[1];
      }
      listArchives(this.queryParamsArch).then((response) => {
        this.archivesList = response.rows;
        this.totalArch = response.total;
      });
    },
    // 取消按钮
    cancelArch() {
      this.archOpen = false;
      this.resetArch();
    },
    // 表单重置
    resetArch() {
      this.formArch = {
        archivesId: null,
        archiveClassifiNum: null,
        archiveFileNum: null,
        archiveCode: null,
        caseFileTitle: null,
        miniatureNum: null,
        projectCode: null,
        personLiable: null,
        compilationDate: null,
        registNum: null,
        storagePosition: null,
        organization: null,
        entryDate: null,
        totalRolls: null,
        currentRolls: null,
        storageTime: null,
        secretLevel: null,
        enginId: null,
        status: null,
        typeId: null,
        createTime: null,
        updateTime: null,
        createBy: null,
        updateBy: null,
        objStr3: null,
      };
      this.resetForm("formArch");
    },
    /** 搜索按钮操作 */
    handleQueryArch() {
      this.queryParamsArch.pageNum = 1;
      this.getListArch();
    },
    /** 重置按钮操作 */
    resetQueryArch() {
      this.daterangeCompilationDate = [];
      this.daterangeEntryDate = [];
      (this.queryParamsArch.archiveClassifiNum = null),
        (this.queryParamsArch.archiveFileNum = null),
        (this.queryParamsArch.archiveCode = null),
        (this.queryParamsArch.caseFileTitle = null),
        (this.queryParamsArch.miniatureNum = null),
        (this.queryParamsArch.projectCode = null),
        (this.queryParamsArch.personLiable = null),
        (this.queryParamsArch.compilationDate = null),
        (this.queryParamsArch.registNum = null),
        (this.queryParamsArch.storagePosition = null),
        (this.queryParamsArch.organization = null),
        (this.queryParamsArch.entryDate = null),
        (this.queryParamsArch.totalRolls = null),
        (this.queryParamsArch.currentRolls = null),
        (this.queryParamsArch.storageTime = null),
        (this.queryParamsArch.secretLevel = null),
        (this.queryParamsArch.enginId = null),
        (this.queryParamsArch.status = null),
        (this.queryParamsArch.createTime = null),
        (this.queryParamsArch.updateTime = null),
        (this.queryParamsArch.createBy = null),
        (this.queryParamsArch.updateBy = null),
        (this.queryParamsArch.objStr1 = null),
        (this.queryParamsArch.objStr2 = null),
        (this.queryParamsArch.objStr3 = null),
        this.resetForm("queryFormArch");
    },
    // 多选框选中数据
    handleSelectionChangeArch(selection) {
      this.archIds = selection.map((item) => item.archivesId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAddArch() {
      this.resetArch();
      this.archOpen = true;
      this.archTitle = "添加案卷管理";
    },
    /**新增案卷远程搜索框 */
    remoteMethodEng(query) {
      if (query !== "" && query != null) {
        listEnginByName({ unitProjectName: query }).then((response) => {
          this.enginListOption = response.rows;
        });
      }
    },
    /** 修改按钮操作 */
    handleUpdateArch(row) {
      this.resetArch();
      const archivesId = row.archivesId || this.archIds;
      getArchives(archivesId).then((response) => {
        this.formArch = response.data;
        this.archOpen = true;
        this.archTitle = "修改案卷管理";
        this.enginListOption[0] = response.data.rEngin; // 下拉菜单
      });
    },
    /** 修改按钮操作 */
    anjuanbaoExport(row) {
      console.log("导出案卷包");
      this.download(
        "system/file/anJuanBaoExport/" + row.archivesId,
        {},
        `案卷包_${new Date().getTime()}.zip`
      );
    },
    /** 提交按钮 */
    submitFormArch() {
      this.$refs["formArch"].validate((valid) => {
        if (valid) {
          if (this.formArch.archivesId != null) {
            updateArchives(this.formArch).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.archOpen = false;
              this.getListArch();
            });
          } else {
            addArchives(this.formArch).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.archOpen = false;
              this.getListArch();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDeleteArch(row) {
      const archivesIds = row.archivesId || this.archIds;
      this.$modal
        .confirm('是否确认删除案卷管理编号为"' + archivesIds + '"的数据项？')
        .then(function () {
          return delArchives(archivesIds);
        })
        .then(() => {
          this.getListArch();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 打印封皮 */
    handlePrintCover(row) {
      // this.coverData = row;
      // print({
      //   printable: "cover-book",
      //   type: "html"
      // });
      this.download(
        "/system/jasper/cover/",
        {
          ...row,
        },
        `封皮_${new Date().getTime()}.pdf`,
        "pdf"
      );
    },
    /** 卷内备考表打印  */
    handlePrintBkTable(row) {
      console.log("卷内备考表打印=====>",row);
      const params = {
        pageCounts: row.pageCounts,
        createBy: row.createBy,
        createTime: row.createTime || " ",
        updateBy: row.updateBy,
        updateTime: row.updateTime || " "
      }
      this.download(
        "/system/jasper/bkTable/",
        {...params},
        `卷内备考表_${new Date().getTime()}.pdf`,
        "pdf"
      );
    },
    /** 验收清单打印  */
    handlePrintAcceptance(row) {
      console.log("验收清单打印=====>",row);
      const params = {
        enginName: row.rEngin.enginName,
        unitProjectName: row.rEngin.unitProjectName,
        handoverUnit: row.rEngin.handoverUnit,
        registNum: row.registNum,
      }
      this.download(
        "/system/jasper/acceptance/",
        {...params},
        `卷内备考表_${new Date().getTime()}.pdf`,
        "pdf"
      );
    },
    /** 高级查询按钮操作 */
    handleHeighArch() {
      this.heightArch.title = "案卷高级查询";
      this.heightArch.open = true;
      this.resetQueryArch(); // 重置查询参数
    },
    /** 高级查询 */
    getHeightArch() {
      for (let key in this.queryParamsArch) {
        if (key === this.heightParam) {
          this.queryParamsArch[key] = this.heightValue;
        }
      }
      this.queryParamsArch.pageNum = 1; // 第一页开始查询
      //this.queryParamsArch.enginId = null; // 清除项目级干扰查询所有
      this.enginList = []; // 清空项目列表
      this.fileList = []; // 清空文件列表
      this.getListArch();
      this.heightValue = null;
      this.heightParam = null;
      this.heightArch.open = false;
    },
    /** 导出按钮操作 */
    handleExportArch() {
      this.download(
        "system/archives/export",
        {
          ...this.queryParamsArch,
        },
        `archives_${new Date().getTime()}.xlsx`
      );
    },
    /** 导入按钮操作 */
    handleImportArch() {
      this.uploadArch.title = "案卷导入";
      this.uploadArch.open = true;
    },
    /** 下载模板操作 */
    importTemplateArch() {
      this.download(
        "system/archives/importTemplate",
        {},
        `archives_template_${new Date().getTime()}.xlsx`
      );
    },
    // 文件上传中处理
    handleFileUploadProgressArch(event, file, fileList) {
      this.uploadArch.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccessArch(response, file, fileList) {
      this.uploadArch.open = false;
      this.uploadArch.isUploading = false;
      this.$refs.uploadArch.clearFiles();
      this.$alert(
        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
          response.msg +
          "</div>",
        "导入结果",
        { dangerouslyUseHTMLString: true }
      );
      this.getListArch();
    },
    // 提交上传文件
    submitFileFormArch() {
      this.$refs.uploadArch.submit();
    },
    // 归档申请按钮
    handleApply() {
      const archivesIds = this.archIds;
      this.$modal
        .confirm('是否确认申请案卷归档编号为"' + archivesIds + '"的数据项？')
        .then(function () {
          return updateArchivesApply(archivesIds);
        })
        .then(() => {
          this.getListArch();
          this.$modal.msgSuccess("申请成功");
        })
        .catch(() => {});
    },
    // 归档审批通过按钮
    handleApprove() {
      const archivesIds = this.archIds;
      this.$modal
        .confirm(
          '是否确认审批通过案卷归档编号为"' + archivesIds + '"的数据项？'
        )
        .then(function () {
          return updateArchivesApprove(archivesIds);
        })
        .then(() => {
          this.getListArch();
          this.$modal.msgSuccess("审批成功");
        })
        .catch(() => {});
    },
    // 归档审批拒绝按钮
    handleReject() {
      const archivesIds = this.archIds;
      this.$modal
        .confirm(
          '是否确认审批拒绝案卷归档编号为"' + archivesIds + '"的数据项？'
        )
        .then(function () {
          return updateArchivesReject(archivesIds);
        })
        .then(() => {
          this.getListArch();
          this.$modal.msgSuccess("审批成功");
        })
        .catch(() => {});
    },
    // 更多操作触发
    handleCommandArch(command, row) {
      switch (command) {
        case "handleDeleteArch":
          this.handleDeleteArch(row);
          break;
        case "handlePrintCover":
          this.handlePrintCover(row);
          break;
        case "handlePrintBkTable":
          this.handlePrintBkTable(row);
          break;
        case "handlePrintAcceptance":
          this.handlePrintAcceptance(row);
          break;
        case "anjuanbaoExport":
          this.anjuanbaoExport(row);
          break;
        default:
          break;
      }
    },

    handlePrintBack() {
      // let data = {
      //   dataList: this.archivesList
      // }
      let dataList = [];
      this.archivesList.forEach((element) => {
        let temp = {};
        temp.archiveFileNum = element.archiveFileNum;
        temp.caseFileTitle = element.caseFileTitle;
        temp.registNum = element.registNum;
        dataList.push(temp);
      });
      console.log("this.dataList======>", dataList);
      this.download(
        "/system/jasper/back/",
        {
          dataList: dataList,
        },
        `背脊_${new Date().getTime()}.pdf`,
        "pdf",
        "application/json"
      );
    },
    /*******************************文件级*************************/
    /** 卷内文件目录打印 */
    handlePrintMenu() {
      // let data = {
      //   dataList: this.archivesList
      // }
      let dataList = [];
      this.fileList.forEach((element, index) => {
        let temp = {};
        temp.sequenceNum = index + 1;
        temp.fileNo = element.fileNo;
        temp.docTitle = element.docTitle;
        temp.objStr1 = element.objStr1;
        temp.pageCounts = element.pageCounts;
        temp.pageNo = element.pageNo;
        temp.remark = element.remark;
        dataList.push(temp);
      });
      console.log("this.dataList======>", dataList);
      this.download(
        "/system/jasper/menu/",
        {
          archivesId: 0, //TODO
          dataList: dataList,
        },
        `卷内文件目录_${new Date().getTime()}.pdf`,
        "pdf",
        "application/json"
      );
    },
    // 打印
    handlePrint() {
      print({
        printable: this.fileList,
        type: "json",
        properties: [
          "sequenceNum",
          "fileNo",
          "docTitle",
          "objStr1",
          "pageCounts",
          "pageNo",
          "remark",
        ],
        properties: [
          {
            field: "sequenceNum",
            displayName: "顺序号",
          },
          {
            field: "fileNo",
            displayName: "文件编号",
          },
          {
            field: "docTitle",
            displayName: "文件题名",
          },
          {
            field: "objStr1",
            displayName: "责任者",
          },
          {
            field: "pageCounts",
            displayName: "页数",
          },
          {
            field: "pageNo",
            displayName: "页号",
          },
          {
            field: "remark",
            displayName: "备注",
          },
        ],
        header:
          '<h3 class="custom-h3">卷内文件目录</h3><div class="custom-1">案卷号：' +
          this.test +
          "</div>",
        style:
          ".custom-h3 { text-align:center } .custom-1{text-align:right;margin-bottom:5px}",
        gridHeaderStyle: "height:100px;border: 1px solid #000000;",
        gridStyle: "height:50px; text-align:center;border: 1px solid #000000;",
      });
    },
    // 文件路径处理
    getFilePath(filePaths) {
      var arrayPath = filePaths.split(",");
      for (let i in arrayPath) {
        arrayPath[i] = this.baseUrl + arrayPath[i];
      }
      return arrayPath;
    },
    // 获取文件名称
    getFileName(name) {
      if (name.lastIndexOf("/") > -1) {
        return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
      } else {
        return "";
      }
    },
    // 打印图片
    printImage(imgPaths) {
      var arrayPath = imgPaths.split(",");
      for (let i in arrayPath) {
        arrayPath[i] = this.baseUrl + arrayPath[i];
      }
      print({
        printable: arrayPath,
        type: "image",
        imageStyle: "width:100%;margin-bottom:20px;",
      });
    },
    /** 查询文件管理列表 */
    getListFile() {
      this.queryParamsFile.params = {};
      if (null != this.daterangeCreateTime && "" != this.daterangeCreateTime) {
        this.queryParamsFile.params["beginCreateTime"] =
          this.daterangeCreateTime[0];
        this.queryParamsFile.params["endCreateTime"] =
          this.daterangeCreateTime[1];
      }
      if (null != this.daterangeUpdateTime && "" != this.daterangeUpdateTime) {
        this.queryParamsFile.params["beginUpdateTime"] =
          this.daterangeUpdateTime[0];
        this.queryParamsFile.params["endUpdateTime"] =
          this.daterangeUpdateTime[1];
      }
      listFile(this.queryParamsFile).then((response) => {
        this.fileList = response.rows;
        this.totalFile = response.total;
      });
    },
    // 取消按钮
    cancelFile() {
      this.openFile = false;
      this.resetFile();
    },
    // 表单重置
    resetFile() {
      this.formFile = {
        fileId: null,
        sequenceNum: null,
        fileNo: null,
        docTitle: null,
        objStr1: null,
        pageCounts: null,
        pageNo: null,
        remark: null,
        archivesId: null,
        filePath: null,
        imgPath: null,
        fileExt: null,
        createTime: null,
        updateTime: null,
        createBy: null,
        updateBy: null,
      };
      this.resetForm("formFile");
    },
    /** 搜索按钮操作 */
    handleQueryFile() {
      this.queryParamsFile.pageNum = 1;
      this.getListFile();
    },
    /** 重置按钮操作 */
    resetQueryFile() {
      this.daterangeCreateTime = [];
      this.daterangeUpdateTime = [];
      this.queryParamsFile.sequenceNum = null;
      this.queryParamsFile.fileNo = null;
      this.queryParamsFile.docTitle = null;
      this.queryParamsFile.objStr1 = null;
      this.queryParamsFile.pageCounts = null;
      this.queryParamsFile.pageNo = null;
      this.queryParamsFile.archivesId = null;
      this.queryParamsFile.filePath = null;
      this.queryParamsFile.imgPath = null;
      this.queryParamsFile.fileExt = null;
      (this.queryParamsFile.createTime = null),
        (this.queryParamsFile.updateTime = null),
        (this.queryParamsFile.createBy = null),
        (this.queryParamsFile.updateBy = null),
        this.resetForm("queryFormFile");
    },
    // 多选框选中数据
    handleSelectionChangeFile(selection) {
      this.fileIds = selection.map((item) => item.fileId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAddFile() {
      this.resetFile();
      this.openFile = true;
      this.titleFile = "添加文件管理";
    },
    /**新增文件远程搜索框 */
    remoteMethodArch(query) {
      if (query !== "" && query != null) {
        listArchivesByName({ caseFileTitle: query }).then((response) => {
          this.archivesListOption = response.rows;
        });
      }
    },
    /** 修改按钮操作 */
    handleUpdateFile(row) {
      this.resetFile();
      const fileId = row.fileId || this.fileIds;
      getFile(fileId).then((response) => {
        this.formFile = response.data;
        this.openFile = true;
        this.titleFile = "修改文件管理";
        this.archivesListOption[0] = response.data.archives; // 下拉菜单
      });
    },
    /** 提交按钮 */
    submitFormFile() {
      this.$refs["formFile"].validate((valid) => {
        if (valid) {
          if (this.formFile.fileId != null) {
            updateFile(this.formFile).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.openFile = false;
              this.getListFile();
            });
          } else {
            addFile(this.formFile).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.openFile = false;
              this.getListFile();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDeleteFile(row) {
      const fileIds = row.fileId || this.fileIds;
      this.$modal
        .confirm('是否确认删除文件管理编号为"' + fileIds + '"的数据项？')
        .then(function () {
          return delFile(fileIds);
        })
        .then(() => {
          this.getListFile();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 高级查询按钮操作 */
    handleHeighFile() {
      this.heightFile.title = "文件高级查询";
      this.heightFile.open = true;
      this.resetQueryFile(); // 重置参数
    },
    /** 高级查询 */
    getHeightFile() {
      for (let key in this.queryParamsFile) {
        if (key === this.heightParam) {
          this.queryParamsFile[key] = this.heightValue;
        }
      }
      this.queryParamsFile.pageNum = 1;
      // this.queryParamsFile.archivesId = null; // 清除案卷级干扰
      this.enginList = []; // 清空项目列表
      this.archivesList = []; // 清空案卷列表
      this.getListFile();
      this.heightValue = null;
      this.heightParam = null;
      this.heightFile.open = false;
    },
    /** 导出按钮操作 */
    handleExportFile() {
      this.download(
        "system/file/export",
        {
          ...this.queryParamsFile,
        },
        `file_${new Date().getTime()}.xlsx`
      );
    },
    /** 导入按钮操作 */
    handleImportFile() {
      this.uploadFile.title = "文件导入";
      this.uploadFile.open = true;
    },
    /** 下载模板操作 */
    importTemplateFile() {
      this.download(
        "system/file/importTemplate",
        {},
        `file_template_${new Date().getTime()}.xlsx`
      );
    },
    // 文件上传中处理
    handleFileUploadProgressFile(event, file, fileList) {
      this.uploadFile.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccessFile(response, file, fileList) {
      this.uploadFile.open = false;
      this.uploadFile.isUploading = false;
      this.$refs.uploadFile.clearFiles();
      this.$alert(
        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
          response.msg +
          "</div>",
        "导入结果",
        { dangerouslyUseHTMLString: true }
      );
      this.getListFile();
    },
    // 提交上传文件
    submitFileFormFile() {
      this.$refs.uploadFile.submit();
    },
    // 更多操作触发
    handleCommandFile(command, row) {
      switch (command) {
        case "handleDeleteFile":
          this.handleDeleteFile(row);
          break;
        case "handleAuthRole":
          this.handleAuthRole(row);
          break;
        default:
          break;
      }
    },
  },
};
</script>

<style scoped>
.point {
  cursor: pointer;
}
.el-upload-list__item {
  border: 1px solid #e4e7ed;
  line-height: 2;
  margin-bottom: 10px;
  position: relative;
}
.ele-upload-list__item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: inherit;
}
.box {
  width: 210mm;
  height: 297mm;
  opacity: 0;
  font-family: "微软雅黑";
  font-size: 14pt;
  z-index: -99;
  position: absolute;
}
.w-20 {
  width: 25%;
}
</style>
